﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Modules.guide {
    import flash.display.*;
    import Mechanics.GameMechanicInterfaces.*;
    import Mechanics.*;
    import Classes.*;
    import Classes.util.*;
    import Mechanics.GameEventMechanics.*;

    public class GuideUtils {

        public static const FIRST_STEP:String = "NewUser";
        public static const FIRST_STEP_CTTC_ALPHA:String = "NewUserCttcAlpha";
        public static const TUTORIAL_ASSETS:String = "assets/dialogs/TutorialAssets.swf";
        public static const CITY_SAM_1:String = "assets/dialogs/citysam_suit01b.png";
        public static const CITY_SAM_2:String = "assets/dialogs/citysam_suit01c.png";
        public static const CITY_SAM_3:String = "assets/dialogs/citysam_suit01d.png";
        public static const CITY_SAM_4:String = "assets/dialogs/citysam_thumbsup_02.png";
        public static const GUIDE_ASSETS_FIRST_STEP:Array = [TUTORIAL_ASSETS, CITY_SAM_1];
        public static const GUIDE_ASSETS_LATER_STEPS:Array = [CITY_SAM_2, CITY_SAM_3, CITY_SAM_4, DelayedAssetLoader.MARKET_ASSETS];

        public static function scanForChild(_arg1:DisplayObjectContainer, _arg2:String):DisplayObject{
            if ((((((_arg1 == null)) || ((_arg2 == null)))) || ((_arg2.length < 1)))){
                return (null);
            };
            var _local3:DisplayObject;
            _local3 = GuideUtils.findChild(_arg1, _arg2);
            if (_local3 != null){
                return (_local3);
            };
            var _local4:uint;
            while (_local4 < _arg1.numChildren) {
                _local3 = _arg1.getChildAt(_local4);
                if (_local3 != null){
                    if (_local3.name == _arg2){
                        return (_local3);
                    };
                    if (_local3.hasOwnProperty("numChildren")){
                        scanForChild((_local3 as DisplayObjectContainer), _arg2);
                    };
                };
                _local4++;
            };
            return (null);
        }
        public static function findChild(_arg1:DisplayObjectContainer, _arg2:String):DisplayObject{
            if ((((((_arg1 == null)) || ((_arg2 == null)))) || ((_arg2.length < 1)))){
                return (null);
            };
            var _local3:DisplayObject;
            var _local4:uint;
            while (_local4 < _arg1.numChildren) {
                _local3 = _arg1.getChildAt(_local4);
                if (((!((_local3 == null))) && ((_local3.name == _arg2)))){
                    return (_local3);
                };
                _local4++;
            };
            return (null);
        }
        public static function getGameObjectByClassName(_arg1:Class):GameObject{
            var _local2:Array = Global.world.getObjectsByClass(_arg1);
            if (_local2.length > 0){
                return (_local2[0]);
            };
            return (null);
        }
        public static function getGameObjectByTypeName(_arg1:String):GameObject{
            var _local2:Array = Global.world.getObjectsByNames([_arg1]);
            return ((_local2.length) ? _local2[0] : null);
        }
        public static function isUpgradeCountable(_arg1:GameObject):Boolean{
            if ((_arg1 is MapResource)){
                return ((_arg1 as MapResource).canCountUpgradeActions());
            };
            return (false);
        }
        public static function getActiveRollCallByTypeNames(_arg1:Array):GameObject{
            var _local3:GameObject;
            var _local4:RollCallDataMechanic;
            var _local2:Array = Global.world.getObjectsByNames(_arg1);
            for each (_local3 in _local2) {
                if (((_local3) && ((_local3 is IMechanicUser)))){
                    _local4 = (MechanicManager.getInstance().getMechanicInstance((_local3 as IMechanicUser), "rollCall", "all") as RollCallDataMechanic);
                    if (((_local4) && (_local4.isActiveObject()))){
                        return (_local3);
                    };
                };
            };
            return (null);
        }

    }
}//package Modules.guide 
